﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "textedit.h"
#include <QMdiSubWindow>
#include <QPrinter>
#include <QActionGroup>
#include <QSignalMapper>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

public:
    void init();
    void initFontSize();
    void initScroll();
    TextEdit* activeSubWindow();
    QMdiSubWindow*findWindow(const QString& filname);

protected:
    void closeEvent(QCloseEvent*event)override;


private slots:
    void on_action_new_triggered();
    void setWindowAction();
    void setDocAction(bool);

    void on_action_open_triggered();

    void on_action_save_triggered();

    void on_action_saveas_triggered();

    void on_action_print_triggered();

    void on_action_printview_triggered();

    void printView(QPrinter*printer);

    void on_action_undo_triggered();

    void on_action_redo_triggered();

    void on_action_cut_triggered();

    void on_action_copy_triggered();

    void on_action_paste_triggered();

    void on_action_close_triggered();

    void on_action_closeall_triggered();

    void on_action_tittle_triggered();

    void on_action_cascad_triggered();

    void on_action_next_triggered();

    void on_action_last_triggered();

    void addSubWindowAction();

    void setActiveSubWindow(QWidget*widget);

    void on_action_color_triggered();

    void on_action_bold_triggered();

    void on_action_italic_triggered();

    void on_action_underline_triggered();

    void on_action_left_triggered();

    void on_action_center_triggered();

    void on_action_right_triggered();

    void on_action_justify_triggered();

    void on_comboBox_symbol_activated(int index);

    void on_fontComboBox_activated(const QString &arg1);

    void on_comboBox_size_activated(const QString &arg1);

private:
    Ui::MainWindow *ui;
    QActionGroup*group;
    QSignalMapper*mapper;
};
#endif // MAINWINDOW_H
